home *** CD-ROM | disk | FTP | other *** search
/ Clinical Endocrinology / Clinical Endocrinology.iso / mac / 00000000 / 20000000 / Shared.dir / 00912_Script_912 < prev    next >
Text File  |  1995-11-17  |  3KB  |  99 lines

  1. -- This handler is just called to puppet the text so that it can be
  2. -- flicked thru by the slider
  3.  
  4. on puppetTextOn
  5.   
  6.   global textChannel
  7.   puppetSprite textChannel, true
  8.   
  9. end puppetTextOn
  10. -------------------------------------------------
  11. -- This handler is the opposite of the above.
  12.  
  13. on puppetTextOff
  14.   
  15.   global textChannel
  16.   puppetSprite textChannel, false
  17.   
  18. end puppetTextOff
  19. -------------------------------------------------
  20. -- This handler takes the values stored by "init" in globals
  21. -- and calculates the pages proportionally along the slider
  22. -- track. It moves the slider along and updates the page count
  23. -- and flicks thru the text.
  24.  
  25. on moveSlider
  26.   
  27.   global firstPage, lastPage, numOfPages, theLeft, theRight
  28.   global targetPage, Slider, slideNum, pageRange
  29.   global textChannel, numberAlign
  30.   
  31.   cursor 200            -- blank cursor
  32.   puppetTextOn
  33.   hyperTextOff
  34.   
  35.   repeat while the stillDown
  36.     set the locH of sprite Slider to the mouseH
  37.     set the locH of sprite slideNum to ┬
  38. ( the locH of sprite Slider ) - numberAlign
  39.     put the locH of sprite Slider - theLeft into currentPos
  40.     if currentPos < 1 then set currentPos = 1
  41.     
  42.     put float( numOfPages / PageRange ) into vIncrement
  43.     put integer((( the locH of sprite  Slider - theLeft )┬
  44.  * vIncrement) + 1) into targetPage
  45.     put targetPage & "/" & integer( numOfPages + 1 ) into field "Readout"
  46.     
  47.     set the castNum of sprite textChannel = ( firstPage + targetPage ) - 1
  48.     
  49.     updateStage
  50.   end repeat
  51.   
  52.   
  53.   go label( string(targetPage) )
  54.   
  55.   puppetTextOff
  56.   hyperTextOn
  57.   cursor -1 -- pointer cursor
  58.   
  59. end moveSlider
  60. ------------------------------------------------
  61. -- This handler calculates where to set the slider on the track
  62. -- and which page to skip to when the arrows are clicked.
  63.  
  64. on calcSlider
  65.   
  66.   global firstPage, lastPage, numOfPages, theLeft, theRight
  67.   global targetPage, Slider, slideNum, pageRange
  68.   global textChannel, numberAlign
  69.   
  70.   put PageRange /  numOfPages  into pageSteps
  71.   set targetPage = value( the frameLabel)
  72.   
  73.   set the locH of sprite Slider = (theLeft + ( targetPage * pageSteps )) - pageSteps
  74.   set the locH of sprite slideNum to ( the locH of sprite Slider ) - numberAlign
  75.   
  76.   put targetPage & "/" & integer( numOfPages + 1 ) into field "Readout"
  77.   
  78.   
  79. end calcSlider
  80. ------------------------------------------------
  81. -- Handler which hides the hypertext while a page flick
  82. -- is in progress.
  83.  
  84. on hyperTextOn
  85.   
  86.   repeat with i = 39 to 45
  87.     set the visible of sprite i to true
  88.   end repeat
  89.   
  90. end hyperTextOn
  91. ------------------------------------------------
  92. on hyperTextOff
  93.   
  94.   repeat with i = 39 to 45
  95.     set the visible of sprite i to false
  96.   end repeat
  97.   
  98. end hyperTextOff
  99. ------------------------------------------------